Repository navigation
fix(rabbitmq): wait the broadcast defer delay before requeueing a deferred message - #217
Merged
Merged
Conversation
…erred message Kafka, NATS, Redis and InMemory hand a deferred broadcast message back after BROADCAST_DEFER_DELAY. RabbitMQ nack-requeued it at once, so a handler that keeps deferring was redelivered at wire speed on this backend alone. The Defer arm now waits the shared delay, cut short by shutdown, before the nack-requeue. The wait holds the single delivery slot, so the message still comes back ahead of the one behind it. Tests pin the delay on RabbitMQ and InMemory; the existing ordering tests did not, and would have passed with the wait removed.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
shove-docs | 0a0d4ec | Commit Preview URL Branch Preview URL |
Sep 25 2026, 11:22 PM |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A broadcast
Deferis retried in place on every backend, and Kafka, NATS, Redis and InMemory waitBROADCAST_DEFER_DELAY(1 s) before handing the message back. RabbitMQ's broadcast router nack-requeued immediately, so a handler that keeps deferring was redelivered at wire speed on this backend only.route_broadcast_outcome'sDeferarm now waitsBROADCAST_DEFER_DELAYbeforenack_requeue, raced against the subscription's shutdown token so a drain is not held open. The wait holds the single delivery slot (broadcast pins prefetch to 1), so the requeued message is still handed back before the message queued behind it.BROADCAST_DEFER_DELAY's re-export is now compiled underrabbitmqas well.Tests
rabbitmq_broadcast_integration::defer_waits_the_defer_delay_and_redelivers_in_place: asserts ordera, a, band a gap of at least 1 s between the twoacalls. It failed before the fix (redelivered after ~0.8 ms).inmemory_broadcast::a_deferred_message_waits_the_defer_delay_before_redelivery: pins the delay InMemory already applied; the existing ordering test would have passed without the wait.Test plan
cargo nextest run --features rabbitmq --test rabbitmq_broadcast_integration(5 passed)cargo nextest run --features rabbitmq,rabbitmq-transactional,metrics --test rabbitmq_integration(82 passed)cargo nextest run --features inmemory,metrics,sbe,env-config(807 passed)cargo fmt -- --check;cargo clippy --all-features --all-targetsand--no-default-features --all-targetswith-D warnings;cargo clippy --lib --no-default-features --features <each backend>with-D warnings